#include"main.h"

//顶层文件
int main()
{
    int choice;
    sqlite3 *db = 0;
    int rc = sqlite3_open("user.db",&db);
    if(rc < 0)
    {
        printf("打开数据库失败\n");
        return 0;
    }
    create_table(db);
    interface1();
        printf("选择你需要的操作\n");
        scanf("%d",&choice);
        while (getchar() != '\n'); 
    while (1)
    {
        switch (choice)
        {
        case 1:user_login(db);
            break;
        case 2:insert_data(db);
            break;
        
        default:
            printf("无效的选择，请重新输入\n");   
            while (getchar() != '\n'); // 清除直到换行符  
            printf("选择你需要的操作\n");  
            if (scanf("%d", &choice) != 1) 
            {  
                while (getchar() != '\n');  
                printf("无效输入，请输入一个整数\n");  
                continue; // 跳回到while (1)循环的开始  
            }  
            break;   
          
        }
        if (choice == 3) break; 
    }
    sqlite3_close(db);
    return 0;
}